#include <bits/stdc++.h>
#define sc(x) scanf("%lld", &(x))
#define pr(x) printf("%lld\n", (x))
#define rep(i, l, r) for (int i = (l); i <= (r); ++i)
using namespace std;
typedef long long ll;
const int N = 1e5 + 7;
const int mod = 1e9 + 7;
int main() {
    freopen("in.txt", "w", stdout);
    srand(time(0));
    int n = 4 + rand() % 2;
    printf("%d\n", n);
    rep(i, 1, n) {
        rep(j, 1, n) {
            int p = rand() % 3 + 1;
            putchar(('0' + (p == 1)));
        }
        putchar(10);
    }
    int t = rand() % 20 + 1;
    printf("%d\n", t);
    while(t--) {
        int x = rand() % n, y = rand() % n;
        printf("%d %d\n", x, y);
    }
    return 0;
}